home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 19 / CU Amiga Magazine's Super CD-ROM 19 (1998)(EMAP Images)(GB)[!][issue 1998-02].iso / CUCD / Utilities / Scion / ARexx / FixLastNames.rexx < prev    next >
OS/2 REXX Batch file  |  1997-09-24  |  2KB  |  70 lines

  1. /****************************************************************************/
  2. /*                                                                          */
  3. /*                          FixLastNames.rexx                               */
  4. /*                                                                          */
  5. /* Written by: Peter Billing, RMB 1240, Yinnar 3869, Australia              */
  6. /*                                                                          */
  7. /* Last saved: Wednesday 29-Sep-93                                          */
  8. /*                                                                          */
  9. /* This script should FIND and REPLACE a given LAST name in the SCION       */
  10. /* database.                                                                */
  11. /*                                                                          */
  12. /****************************************************************************/
  13.  
  14. options results
  15. /*test = show('P','SCIONGEN')
  16.  then
  17. say
  18. say "I am sorry to say that the SCION Genealogist database is not available."
  19. say "Please start the SCION program BEFORE using this script."
  20. say
  21. exit */
  22.  
  23.  myport = "SCIONGEN"
  24. address value myport
  25. getdbname
  26. dbname = upper(result)
  27. say ""
  28. say "The current database name is " dbname
  29. say
  30. say "This script will FIND and REPLACE all Last Names you ask for"
  31. say "with a NEW one given by you. Just press RETURN to exit."
  32. say
  33. writech(stdout, "What LAST name you would like replaced? ")
  34. pull findname
  35. if findname = "" then exit
  36. say
  37. say "EVERYTHING after and including" findname "will be deleted"
  38. say "What is the replacement LAST NAME."
  39. pull replacename
  40. say
  41.  
  42. gettotalirn
  43. total = result
  44. t=0
  45. say "Hang on there are "total" LAST names to check."
  46. do x = 1 to total
  47.   getlastname x
  48.   FixLastName(result)
  49.   putlastname x name
  50.   if x/5 = x%5 then writech(stdout,".")
  51. end
  52. say
  53. say "I changed a total of "t" LAST names."
  54. say
  55. say "Do not forget to save the new "dbname" database."
  56. say
  57. exit
  58.  
  59. FixLastName:
  60. parse arg name
  61. a = 0
  62. a = pos(findname,name)
  63. if a > 0 then do
  64.    name = delstr(name,a)
  65.    name = insert(replacename,name,a-1)
  66.    t = t + 1
  67. end
  68. return name t
  69.  
  70.